import { useDpSchema } from '@ray-js/panel-sdk';

export const useDpIdByCode = <T extends string | string[] | number[]>(
  code: string | string[]
): T => {
  const dpSchema = useDpSchema();
  const result = Array.isArray(code) ? code.map(c => dpSchema?.[c]?.id) : dpSchema?.[code]?.id;
  return result as T;
};
